package com.haz.mybatis.test;

import com.haz.mybatis.mapper.UserMapper;
import com.haz.mybatis.pojo.User;
import com.haz.mybatis.utils.SqlsessionUtils;
import org.junit.Test;

import java.util.List;

public class testUser {
    @Test
    public void testgetUser() {
        UserMapper userMapper = SqlsessionUtils.getsqlSession().getMapper(UserMapper.class);
//        User user = userMapper.getUserById(11);
//        System.out.println("user:"+user);
//        List<User> list = userMapper.getAllUer();
//        System.out.println(list.size()); // 查询list集合的总记录数
//        list.forEach(user -> System.out.println(user));
//        System.out.println(userMapper.getCount()); // 查询总记录数
        // 使用map进行查询
//        System.out.println(userMapper.getUserByIdToMap(11));
        System.out.println(userMapper.getAllUserToMap());
    }

}
